<template>
   <van-swipe :autoplay="3000" lazy-render class="van-swipe">
       <van-swipe-item v-for="image in images" :key="image" >
           <img :src="image" />
       </van-swipe-item>
   </van-swipe>
   <h3>好男人就买他</h3>
   <div>
       <van-swipe-cell v-for="item in itemsb" :key="item.id" >
           <van-card :num="item.saleNum" :price="item.originPrice" desc="缘分天空我们的梦" :title="item.title" class="goods-card"
               :thumb="item.image" @click="$router.push({path:'/goods_detail',query:{id:item.id}})"/>
           <template #right>
               <van-button square text="删除" type="danger" class="delete-button" />
           </template>
       </van-swipe-cell>
   </div>
</template>

<script setup>
import { ref } from 'vue';
import { getHomeData } from '../../../api/home'

const dizhi = 'https://www.pmdaniu.com/storages/124137/4fd65663c237204d6e2adfba9b23af2f-103297/images/%E5%8F%91%E7%8E%B0%E6%A0%B7%E5%BC%8F1/'
const images = ref([
   dizhi+'u616.jpg',
   dizhi+'u617.jpg',
   dizhi+'u618.jpg',
   dizhi+'u619.jpg',
   dizhi+'u616.jpg',
])

const itemsb = ref([])
async function foo(){
    const result=await getHomeData()
    const{items}=result
    itemsb.value.push(...items.list)
}
foo()

</script>

<style lang="less" scoped>
.van-swipe{
    margin-top: 20px;
}
.my-swipe .van-swipe-item {
   color: #fff;
   font-size: 20px;
   line-height: 150px;
   text-align: center;
   background-color: #39a9ed;
}

img {
   width: 100%;
   height: 100%;
}
</style>